Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Make the dialogUserController a little bit more API driven #6400

Closed
wants to merge 5 commits into from

Conversation

skateman
Copy link
Member

@skateman skateman commented Nov 11, 2019

I went through the initialization process of the dialogUserController, flattened the promise chain and started thinking about retrieving stuff from the API. So far I was successful with the replacing of default values when duplicating a service request. The tags are also loaded from the API, replacing the original values coming from the schema.

Eventually, I don't want to have these values in the dialog schema, but that's something we need to change in the backend. Also we can exist without this change for a while 😉

There are some issues with the TagControl right now, because it's not using the miqSelect that has been already utilized in the dropdowns, but a fix is already on its way.

The backend also sends us in the schema the <None> and <Choose> elements in dropdowns, which is a bad practice. My plan is to move this logic into the frontend as it is a presentation layer matter and it has nothing to do with the backend, that should provide data only. This would affect the DropdownList as well, because it uses a similar logic, but as its values are static, it would need a backend change.

Related issue: ManageIQ/manageiq#19483
@miq-bot add_label refactoring, ivanchuk/no, angular dialogs

if (field.type == 'DialogFieldTagControl') {
promises.push(API.get('/api/categories/' + field.options.category_id + '/tags?expand=resources&attributes=categorization').then(function(response) {
field.values = response.resources.map(function(tag) {
return { value: tag.id, name: tag.name, description: tag.categorization.description };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return { id: tag.id, name: tag.name, description: tag.categorization.description }; should work

dialog-user is using fieldValue.id as fieldValue.description for fieldValue in vm.dialogField.values so value is ignored

@skateman skateman force-pushed the dialog-user-promises branch from fe88b9c to 736b6b6 Compare November 21, 2019 08:39
@miq-bot
Copy link
Member

miq-bot commented Nov 21, 2019

Checked commits skateman/manageiq-ui-classic@161b52d~...736b6b6 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@miq-bot miq-bot added the stale label Jun 11, 2020
@miq-bot
Copy link
Member

miq-bot commented Jun 11, 2020

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s)

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.

@gtanzillo gtanzillo removed the stale label Jul 20, 2020
@skateman
Copy link
Member Author

Closing as we're not taking this approach...

@skateman skateman closed this Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants